-- wait a little bit. I don't know how to put a DOS prog into window without STARTing it
InfoBox('Please relax...','Wait till the program finishes. I do not know how to run DOS windowed program and wait till it finishes. Please send me the solution if you know it.')
return
DEFC cstex_texit
universal pm4epm_MasterNotFound, cstex_reLaTeXed
parse arg action x
if action='S' then
i=length(.filename)
if (i>4) and (upcase(substr(.filename,i-3,4))='.LOG') -- update 28.5.1996
then e='% MASTER: 'substr(.filename,1,i-4)'.tex'
insertline e,1
N=pm_expansion('%format.cmd %N') -- you edit .log file, thus name only
else N=pm_expansion('%format.cmd %.N') -- full name
endif
if pm4epm_MasterNotFound=1 then return ''; endif
save_the_ring()
e=get_env('EMTEXOPT'); -- now cool tricks to set up EMTEXOPT environment variable
if (words(e)>0) then e=e' ' endif
e=e''pm_expansion('%optsemtex')
if (words(e)=0) then e=N; else e='(set EMTEXOPT='e') & 'N; endif
'start /c /win /f cmd.exe /c "'e'"'
cstex_reLaTeXed=1 -- information for cstex_next_error
if (i>0) and (upcase(substr(.filename,i,length(.filename)-i))='LOG')
then N=pm_expansion('%format.cmd %.N') -- full name
if pm4epm_MasterNotFound=1 then return ''; endif
else N=pm_expansion('%format.cmd %N') -- you edit .log file, thus name only
endif
*/
i=length(.filename)
if (i>4) and (upcase(substr(.filename,i-3,4))='.LOG') -- update 28.5.1996
then e='% MASTER: 'substr(.filename,1,i-4)'.tex'
insertline e,1
N=pm_expansion('%format.cmd %N') -- you edit .log file, thus name only
else N=pm_expansion('%format.cmd %.N') -- full name
endif
if pm4epm_MasterNotFound=1 then return ''; endif
save_the_ring()
e=get_env('EMTEXOPT') -- again cool tricks to set up EMTEXOPT environment variable
if (words(e)>0) then e=e' ' endif
e=e''pm_expansion('%optsemtex')
if (words(e)=0) then e='/b'; else e=e' /b'; endif -- "je to spicovy", it works!
c='start /c /win /b '
if (cstex_true_tex_background<>0) then c=c'/min '; endif
c=c'cmd.exe /c "(set EMTEXOPT='e') & 'N
if (cstex_background_beep<>0) then c=c' & echo '; endif
c'"'
-- previously: 'start /c /win /b cmd.exe /c 'N
cstex_reLaTeXed=1 -- information for cstex_next_error
elseif action='I' then sayerror cstex_texit_background_inf
endif
DEFC cstex_preview
universal pm4epm_MasterNotFound
parse arg action
if action='S' then
M=pm_expansion('%m')
-- it was: '%M' and pointed out by Kroni: TeX always outputs in the current directory
-- if pm4epm_MasterNotFound=1 then return ''; endif -- you can have only .dvi file
if EXIST(M'.dvi')=0 then ErrorBox('Error','.dvi file not found. Please run (La)TeX first.'); return; endif
'start dvipm.exe @dvipm.cnf ' M
elseif action='I' then sayerror cstex_preview_inf
endif
-- Temporary version. See remark in the routine below.
DEFPROC cstex_dvips (opts)
universal pm4epm_MasterNotFound
Master=pm_expansion('%m') -- changed from '%M'
dvipsopts=pm_expansion('%optsdvips')
-- if pm4epm_MasterNotFound=1 then return ''; endif
if EXIST(Master'.dvi')=0 then ErrorBox('Error','.dvi file not found. Please run (La)TeX first.'); return; endif
COMPILE IF CSTEX_CSTEX=1
'start /win /c /dos dvi-out -m 'Master
PleaseRelax()
COMPILE ENDIF
-- 'cmd /c dvips 'opts' 'Master
x='dvips 'dvipsopts' 'opts' 'Master
sayerror x
'cmd /c 'x
return Master
/* -- This is an alternative version TO BE USED AFTER someone compiles dvi-out for OS/2
DEFPROC cstex_dvips (opts)
universal pm4epm_MasterNotFound
Master=pm_expansion('%M')
dvipsopts=pm_expansion('%optsdvips')
-- if pm4epm_MasterNotFound=1 then return ''; endif
if EXIST(Master'.dvi')=0 then ErrorBox('Error','.dvi file not found. Please run (La)TeX first.'); return; endif
COMPILE IF CSTEX_CSTEX=1
'cmd /c csdvips 'dvipsopts' 'opts' 'Master
COMPILE ELSE
'cmd /c dvips 'dvipsopts' 'opts' 'Master
COMPILE ENDIF
return Master
*/
DEFC cstex_dvips
parse arg action opts
if action='S' then call cstex_dvips(opts)
elseif action='I' then sayerror cstex_dvips_inf
endif
DEFC cstex_gvpm
parse arg action x
if action='S' then
Master=cstex_dvips('')
if Master<>'' then 'start gvpm 'Master'.ps' endif
endif
DEFC cstex_psview
parse arg action x
if action='S' then Master=cstex_dvips('');
if Master<>'' then 'pm_command_dosfs S psview.bat %m.ps' endif
endif
DEFC cstex_about
InfoBox('This is CSTeX for EPM','Version 8.6.1996'\13\13'Written by Petr Mikulík'\13' Dept. of Solid State Physics'\13' Masaryk University'\13' Brno, Czech Republic'\13\13'pmCSTeX for EPM resides at http://www.sci.muni.cz/~mikulik/os2.html')
DEFC cstex_bugs
WinMessageBox('This is CSTeX for EPM','Please address your bug reports, suggestions, comments, congratulations, improvements and solutions by e-mail to mikulik@physics.muni.cz',MB_OK + MB_MOVEABLE +MB_ERROR)
s=updir'\units\'Name -- there could be my .h files
if EXIST(s)=0 then s='\emtex\texinput\'Name -- there could be my .tex or .sty files
if EXIST(s)=0 then s='\emx\include\'Name -- look for GNU C/C++ files
if EXIST(s)=0 then s='\emx\include\cpp\'Name -- look for GNU C/C++ files
if EXIST(s)=0 then s='\emx\include\sys\'Name -- look for GNU C/C++ files
if EXIST(s)=0 then s='\emx\include\cpp\gen\'Name -- look for GNU C/C++ files
endif endif endif endif endif endif endif
*/
-- now open it if exists
getfileid Lid, s -- is that file in ring?
if Lid<>'' then activatefile(Lid); return; endif
if EXIST(s)<>0
then 'edit 's; --PMTOGGLE 'a_togl_hilit S'
else ErrorBox('Sorry','File 'Name' not found.'\13\13'You can try to edit CSTeX.e, routines cstex_WhereExists and cstex_include, to supply your favourite paths and extensions.')
endif
elseif action='I' then sayerror cstex_include_inf
endif
DEFC cstex_cykl
universal pm4epm_MasterNotFound
parse arg action
if action='S' then
-- 'pm_command_cmd S cykl! %.W call %format.cmd %.N'
elseif action='I' then sayerror cstex_highlight_all_inf
endif
DEFC cstex_save_all
parse arg action x
if action = 'S' then
sayerror ''
call save_the_ring()
elseif action='I' then sayerror cstex_save_all_inf
endif
COMPILE IF CSTEX_CSTEX=1
COMPILE IF CSTEX_CS2CS=1
DEFC CStoCS
-- CS2CS using OS/2 program
w=pm_expansion('%.W')
'save 'w -- save
CP='*CP852 (PC Latin II - CP 852)*KEYBCS2 (podle Kamenickych)*CP850 (PC Latin I - CP 850)*IBM852 (Latin II - IBM 852)*ISO-8859-1 (ISO-8859-1 Latin 1)*ISO-8859-2 (ISO-8859-2 Latin 2)*TEX1 (TeX, \v{C})*TEX2 (TeX, \v C)*CORKY (podle Corky)*CP1250 (MS-Windows - CP 1250)*KOI8-CS (KOI8-CS)*MAC (Macintosh)*'
id=id+1; buildmenuitem defaultmenu, cstexid, id, 'PM Preview before print', ' '\1'Preview document by dvipm with @_theprinter_.cnf and VIEWOPTS:',17+64,0
id=id+1; buildmenuitem defaultmenu, cstexid, id, 'FS Preview before print', ' '\1'Preview document by dviscr with @_theprinter_.cnf and VIEWOPTS:',17+64,0